import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
import Layout from '@/layout/Layout.vue'


const routes: RouteRecordRaw[] = [
    // 位置无所谓了
    { path: '/:pathMatch(.*)*', name: 'NotFound', component: () => import('@/views/error/index.vue') },
    {
        path: '/login',
        component: () => import('@/views/login/index.vue')
    },
    {
        path: '/',
        redirect: '/login'
    },
    // 数据中心板块(首页)
    {
        path: '/home',
        component: Layout,
        redirect: '/home/index',
        meta: { title: '首页', path: '/home' },
        children: [
            {
                path: 'index',
                meta: { title: '数据首页', path: '/home/index' },
                component: () => import('@/views/home/index.vue')
            }
        ]
    },
    // 医院综合：general
    {
        path: '/general',
        component: Layout,
        redirect: '/general/list',
        meta: { title: '医院综合', path: '/general' },
        children: [
            {
                path: 'list',
                meta: { title: '科室管理', path: '/general/list' },
                component: () => import('@/views/general/general-list.vue')
            },
            {
                path: 'add',
                meta: { title: '添加科室', path: '/general/add' },
                component: () => import('@/views/general/general-add.vue')
            }
        ]
    },
    // 患者大数据
    {
        path: '/data',
        component: Layout,
        redirect: '/data/pie',
        meta: { title: '患者大数据', path: '/data' },
        children: [
            {
                path: 'pie',
                meta: { title: '病情分析表', path: '/data/pie' },
                component: () => import('@/views/data/data-pie.vue')
            },
            {
                path: 'chart',
                meta: { title: '药品耗材表', path: '/data/chart' },
                component: () => import('@/views/data/data-chart.vue')
            }
        ]
    },
    // 动态个人
    {
        path: '/personal',
        component: Layout,
        redirect: '/personal/index',
        meta: { title: '动态个人', path: '/personal' },
        children: [
            {
                path: 'index',
                meta: { title: '挂号管理', path: '/personal/index' },
                component: () => import('@/views/personal/index.vue')
            }
        ]
    },
    // 中西医药房
    {
        path: '/drugs',
        component: Layout,
        redirect: '/drugs/list',
        meta: { title: '中西医药房', path: '/drugs' },
        children: [
            {
                path: 'list',
                meta: { title: '处方综合管理', path: '/drugs/list' },
                component: () => import('@/views/drugs/drugs-list.vue')
            },
            {
                path: 'chart',
                meta: { title: '营收数据表', path: '/drugs/chart' },
                component: () => import('@/views/drugs/drugs-chart.vue')
            },
        ]
    },
    // 医疗药品出入库
    {
        path: '/warehouse',
        component: Layout,
        redirect: '/warehouse/list',
        meta: { title: '医疗药品出入库', path: '/warehouse' },
        children: [
            {
                path: 'add',
                meta: { title: '添加药品耗材', path: '/warehouse/add' },
                component: () => import('@/views/warehouse/ware-add.vue')
            },
            {
                path: 'list',
                meta: { title: '医疗品综合管理', path: '/warehouse/list' },
                component: () => import('@/views/warehouse/ware-list.vue')
            },
        ]
    },
    // 医疗前线
    {
        path: '/line',
        component: Layout,
        redirect: '/line/list',
        meta: { title: '医疗前线', path: '/line' },
        children: [
            {
                path: 'list',
                meta: { title: '处方综合管理', path: '/line/list' },
                component: () => import('@/views/line/line-list.vue')
            },
            {
                path: 'add',
                meta: { title: '处方开具', path: '/line/add' },
                component: () => import('@/views/line/line-add.vue')
            },

        ]
    },
    // 分级医生
    {
        path: '/doctor',
        component: Layout,
        redirect: '/doctor/info',
        meta: { title: '分级医生', path: '/doctor' },
        children: [
            {
                path: 'info',
                meta: { title: '排班管理', path: '/doctor/info' },
                component: () => import('@/views/doctor/doc-info.vue')
            },
            {
                path: 'list',
                meta: { title: '综合列表', path: '/doctor/list' },
                component: () => import('@/views/doctor/doc-list.vue')
            },
            {
                path: 'add',
                meta: { title: '修改个人信息', path: '/doctor/add' },
                component: () => import('@/views/doctor/doc-add.vue')
            },


        ]
    },
    // 分级护士
    {
        path: '/nurse',
        component: Layout,
        redirect: '/nurse/info',
        meta: { title: '分级护士', path: '/nurse' },
        children: [
            {
                path: 'info',
                meta: { title: '排班管理', path: '/nurse/info' },
                component: () => import('@/views/nurse/nurse-info.vue')
            },
            {
                path: 'list',
                meta: { title: '综合列表', path: '/nurse/list' },
                component: () => import('@/views/nurse/nurse-list.vue')
            },
            {
                path: 'add',
                meta: { title: '修改个人信息', path: '/nurse/add' },
                component: () => import('@/views/nurse/nurse-add.vue')
            },


        ]
    },
    // 病床管理
    {
        path: '/bed',
        component: Layout,
        redirect: '/bed/list',
        meta: { title: '病床管理', path: '/bed' },
        children: [
            {
                path: 'list',
                meta: { title: '综合管理', path: '/bed/list' },
                component: () => import('@/views/bed/bed-list.vue')
            },
            {
                path: 'add',
                meta: { title: '添加床位', path: '/bed/add' },
                component: () => import('@/views/bed/bed-add.vue')
            },
        ]
    },
    // 全账号管理
    {
        path: '/acc',
        component: Layout,
        redirect: '/acc/list',
        meta: { title: '全账号管理', path: '/acc' },
        children: [
            {
                path: 'list',
                meta: { title: '账号综合管理', path: '/acc/list' },
                component: () => import('@/views/account/acc-list.vue')
            },
            {
                path: 'add',
                meta: { title: '添加账号', path: '/acc/add' },
                component: () => import('@/views/account/acc-add.vue')
            },
        ]
    },

]

const router = createRouter({
    // 创建路由的模式： hash（/#/xxx） 与 history(/xxxx)
    history: createWebHashHistory(),
    routes,
})

export default router